package com.ctk.wifi;

import com.ctk.wifi.a.net.TCPActivity;
import com.ctk.wifi.a.net.UDPActivity;
import com.ctk.wifi.business.normal.HttpActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainMenuActivity extends BaseActivity
{

	private ListView listMenu;

	private Class<?>[] activitys = new Class[] { 
			TCPActivity.class, 
			UDPActivity.class,
			HttpActivity.class};

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ctk_main_menu);
		listMenu = (ListView) findViewById(R.id.list_main_menu);
		listMenu.setAdapter(new ArrayAdapter<String>(getBaseContext(),
				android.R.layout.simple_list_item_1, android.R.id.text1,
				getResources().getStringArray(R.array.main_menu_list)));
		
		//添加点击动作响应
		listMenu.setOnItemClickListener(new OnItemClickListener()
		{
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id)
			{
				startActivity(new Intent(getBaseContext(), activitys[position]));
			}
		});
	}

	//退出时，注销APP
	/**
	@Override
	protected void onDestroy()
	{
		super.onDestroy();
		getApp().exitApp();
	}
	*/
}
